import { FormItemRule } from "naive-ui";
const feedbackFormConfig: Record<string, any> = {
	isVertical: true,
	labelWidth: 80,
	labelPlacement: "left",
	formItems: [
		{
			field: "topic",
			inputType: "text",
			labelStyle: "fontSize:14px;fontWeight:bold;",
			type: "Input",
			placeholder: "主题（最多40）字",
		},
		{
			field: "advise",
			labelStyle: "fontSize:14px;fontWeight:bold;",
			type: "TextArea",
			inputType: "textarea",
			placeholder: "您有什么意见或建议，或者您需要什么帮助（最多300字）",
			autosize: {
				minRows: 5,
				maxRows: 10,
			},
		},
	],
	rules: {
		topic: {
			required: true,
			trigger: ["input"],
			message: "请输入主题",
			validator(rule: FormItemRule, value: string) {
				if (value.length === 0) {
					return new Error("主题不可为空");
                }
                if (value.length > 40) {
                    return new Error("主题超出字数限制");
                }
				return true;
			},
		},
		advise: {
			required: true,
			trigger: ["input"],
			message: "请输入意见",
			validator(rule: FormItemRule, value: string) {
				if (value.length === 0) {
					return new Error("意见不可为空");
				}
				if (value.length > 300) {
					return new Error("意见超出字数限制");
				}
				return true;
			},
		},
	},
};
export default feedbackFormConfig;
